/******************************************************************************

                  ��Ȩ���� (C), 2019-2029, SDC OS ��Դ����С������

 ******************************************************************************
  �� �� ��   : opencv_api.h
  �� �� ��   : ����
  ��      ��  s30001871
  ��������   : 2020��7��4��
  ����޸�   :
  ��������   : opencv_api������
  �����б�   :
  �޸���ʷ   :
  1.��    ��   : 2020��7��4��
  ��    ��   ��s30001871
    �޸�����   : �����ļ�

******************************************************************************/
#ifndef __HW_OPENCV_API_H__
#define __HW_OPENCV_API_H__

#include "opencv2/core/core.hpp"

#include "sdc_os_api.h"
#include "hw_cv_type.h"
#include <vector>
#include "types.h"

extern GC_APP_CONFIG gc_app_config;

bool YUVResize(sdc_yuv_frame_s &yuvFrame, int resize_w, int resize_h, unsigned char * pyuv, cv::Mat &dst);
bool YUVResize(sdc_yuv_frame_s &yuvFrame, int resize_w, int resize_h, unsigned char * pyuv, cv::Mat &dst, std::string &save_path);

float GetScaleRatio(int src_w, int src_h,int forwardsize_w, int forwardsize_h);

void SetSdcYuvFrame(int src_w, int src_h, sdc_yuv_frame_s *pstRGBFrameData);

int ProcessInputPath(const char* imgPath, int &input_w, int &input_h, uint8_t **pyuv);

void DrawImgBoxes(cv::Mat &input, const SDC_SSD_RESULT_S *stResult, float ratio);

void DrawImgBoxes(cv::Mat &input, const SDC_SSD_OBJECT_INFO_S* infos, float ratio);

void DrawImage(cv::Mat &mat, const SDC_SSD_RESULT_S* stResult, int src_w, int src_h, int for_w,int for_h);

int TransYuv2Jpg(unsigned char *yuvAddr, int w, int h, const char *imgPath);

void readJpgData(const char *imgPath, std::vector<unsigned char>& jpgData);

int CropInGivenRect(sdc_yuv_frame_s &yuvFrame, const SDC_SSD_OBJECT_INFO_S *infos, std::vector<unsigned char>& jpgData);

int ReadImgFile(const char *imgPath, ImageInfo& image);

int drawObjbox(const char *jpgName, std::vector<ObjBox> &objBoxs);

void TransFormJpg2Yuv(cv::Mat &img, unsigned char *yuv_nv21);

int ReadLprImage(const char *jpgName, unsigned char*inputBlob);

int ReadLprMat(const cv::Mat& srcImage, unsigned char*inputBlob);

int CropMat(cv::Mat &dst, const SDC_SSD_OBJECT_INFO_S *infos, std::vector<unsigned char>& jpgData);

#endif /* __HW_OPENCV_API_H__ */